USE master;
GO
IF EXISTS (SELECT name FROM master.dbo.sysdatabases WHERE name = N'HumanResources')
	DROP DATABASE HumanResources
GO
CREATE DATABASE HumanResources;
GO
USE HumanResources;
GO
CREATE SCHEMA hr;
GO

SELECT e.EmployeeID, p.FirstName, p.LastName, e.Title AS JobTitle
INTO hr.Employees
FROM AdventureWorks.HumanResources.Employee e
JOIN AdventureWorks.Person.Contact p
ON e.ContactID = p.ContactID
ORDER BY e.EmployeeID
GO

SELECT e.EmployeeID, p.EmailAddress
INTO hr.EmailAddresses
FROM AdventureWorks.HumanResources.Employee e
JOIN AdventureWorks.Person.Contact p
ON e.ContactID = p.ContactID
ORDER BY e.EmployeeID
GO
